1. Field of the Invention
The present invention relates to an image processing device and an image processing method, for imaging an inspection target with a camera, to execute measurement processing by use of the obtained image data.
2. Description of Related Art
In a large number of production sites such as plants, there have been introduced image processing devices which automatize and speed up inspections that have been relied upon visual checkup. The image processing device images, with a camera, a work flowing along a production line such as a belt conveyer, and executes measurement processing such as edge detection and area calculation of a predetermined area by use of the obtained image data. Subsequently, based upon a processing result of the measurement processing, inspections such as chipping detection of the work and positional detection of an alignment mark are performed, and a determination signal for determining the presence or absence of a chip of the work and displacement is outputted. In this manner, the image processing device may be utilized as one of FA sensors.
The image processing devices include a package type image processing device which executes a previously decided sequence of image processing, and an image processing device to which an image processing program for executing a desired processing sequence, created by a user on a personal computer, is transmitted and which then executes measurement processing as desired. The former can execute image processing only in the previously decided processing sequence, thereby to restrict the degree of freedom of image processing, while the latter requires high programming skills and a great number of man-hours for executing the desired measurement processing. As an image processing device for solving these problems, there is an image processing device in which a series of processing sequences of inspection items in image processing is displayed in the form of a flowchart, and the processing sequence is made changeable by the user on the flowchart (e.g. see Japanese Unexamined Patent Publication No. 09-288568). In order for the user to realize a desired processing sequence, for example, a processing sequence is customized on the flowchart by means of dedicated software on a PC, a processing sequence program is created for making the image processing device execute the customized processing sequence, and thereafter the processing sequence program is transmitted to a controller of the image processing device.
According to such an image processing device, a processing sequence of image processing can be customized with a small number of man-hours on the flowchart without the need for high programming skills. Further, although there are cases where the number of inspection items is several tens or several hundreds at the time of intending to perform complex image processing, when a series of processing sequences is displayed in the form of a flowchart, the user can grasp contents of overall image processing at one view, thereby to perform desired customization while overlooking an overall flowchart, and further to enhance the degree of freedom of the image processing. Moreover, by executing each piece of image processing in synchronization with the processing sequence shown in the flowchart, an operation of writing image data obtained by imaging into a memory and an operation of reading image data for executing measurement processing from the memory are not performed in the same timing, and thereby a memory conflict problem can also be prevented. Furthermore, debugging can be performed along the processing sequence, and thereby bug correction can also be facilitated.
In inspection settings with such image processing, first, essential image processing such as imaging and individual image processing required for inspection, such as edge detection and area calculation, are selected as inspection items, which are then arranged into a desired sequence (e.g. in a top-to-bottom sequence), to produce a flowchart showing a processing sequence. In addition, as described above, the processing sequence can be changed on the flowchart by changing the arrangement of the inspection items. Further, for creating and editing the flowchart, a personal computer connected to the image processing device can also be used, and a monitor, a console and the like connected to the image processing device can also be used.
Next, along with a setting of a parameter value to each inspection item, settings of a registered image required for a specific inspection item, such as pattern searching, and the like are performed. Specifically describing, for example, parameter values for designating an imaging-target camera, a shutter speed, and the like are set. Further, in the edge detection and the area calculation, determination conditions for determining the presence or absence of a chip of a work and displacement, and the like are set. Moreover, in pattern searching for specifying, for example, whether or not a specific pattern appears in image data obtained by imaging an inspection target and where the specific pattern is located in the case where the pattern appears, an image as a reference of a specific pattern is previously set as a registered image. After completion of creating and editing a flowchart by selection and arrangement of inspection items, setting optimal parameter values for respective inspection items and setting an optimal registered image as needed, the inspection setting is completed, and according to the created flowchart, a normal operation of the image processing device is started.
Herein, after the inspection setting has once been completed and the normal operation of the image processing device has been started, the same parameter values and registered image are desirably kept being used so as to make maintenance unnecessary. However, there are cases where the parameter value or the registered image is wished to be edited due to a change in image lighting environment caused by aged deterioration in LED for lighting a work or a change in kind of work flowing along the production line. Additionally, there are cases where the appropriateness of the parameter values and the registered image after editing are wished to be verified by performing a simulation by use of the parameter values and the registered image after editing. Since a general image processing device has one processor for executing the foregoing measurement processing such as edge detection and area calculation, when the user is to edit the parameter value or the registered image or perform a simulation by use of the parameter values and the registered image after editing, it has been necessary to temporarily stop the normal operation of the image processing device.
Nevertheless, when the normal operation of the image processing device being used also as the FA sensor is temporarily stopped, a production line also needs to be stopped, bringing about decreased production efficiency. Especially when the normal operation of the image processing device is stopped with intent to edit the registered image, a certain amount of time, such as several seconds or several minutes, is required. Taking a specific example, in the case of an unnecessary portion (noise, etc.) being present as a specific pattern in the registered image, the user first temporarily stops the operation of the image processing device, and sets the unnecessary portion as a mask area (area for sealing an unnecessary portion) with use of a console and a monitor connected to the image processing device, and the user can then edit a more optimal registered image, but this operation requires a certain amount of time. Further, when a simulation is to be further performed using the registered image after editing, it requires further more time.
In this respect, for example as disclosed in Japanese Unexamined Patent Publication No. 08-128960, providing two sets of CPUs and memories may make it possible to edit the registered image and perform a simulation by use of the registered image after editing without stopping the normal operation. Specifically, the normal operation is performed with one CPU and memory, and the registered image is edited and the simulation is performed using the registered image after editing with the other CPU and memory. When the registered image after editing is wished to be used as a result of the simulation, the normal operation is switched so as to be next performed with the other CPU and memory. Subsequently, during the normal operation performed with the other CPU and memory, the registered image is edited and the simulation is performed using the registered image after editing with the one CPU and memory. Alternately performing the normal operation and the simulation with two sets of CPUs and memories in such a manner may make it possible to edit the registered image and perform the simulation by use of the registered image after editing without stopping the normal operation.
However, when the normal operation and the simulation are to be alternately performed with two sets of CPUs and memories (when two sets of CPUs and memories are to be mirrored), two sets of CPUs and memories having the same performance are required. Especially as for the memory, one memory and the other memory need to have an equivalent storage capacity, which results in an increase in heap area that needs to be ensured, making it difficult to efficiently make use of memory resources.